﻿namespace WMS6.Web.Inventory
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;

    public class OrderMovementQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlMovementID;
        protected DropDownList ddlMovementTypeOper;
        protected DropDownList ddlReasonCodeOper;
        protected DropDownList ddlStatusOper;
        protected HtmlForm F5220;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlHead Head1;
        protected Label lblMovementID;
        protected Label lblMovementType;
        protected Label lblReasonCode;
        protected Label lblStatus;
        protected Label lblSys_Code;
        protected MultipleSelectControl MSCMovementType;
        protected MultipleSelectControl MSCReasonCode;
        protected MultipleSelectControl MSCStatus;
        protected HtmlLink mycss;
        protected TextBox txtMovementID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("OrderMovementList.aspx?from=list&action={0}", base.UrlEncode(this.hdnActionID.Value)), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("OrderMovementList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void LoadData()
        {
            base.InitQueryDDL(this.ddlMovementID, 0);
            base.InitQueryDDL(this.ddlMovementTypeOper, 0);
            base.InitQueryDDL(this.ddlReasonCodeOper, 0);
            base.InitQueryDDL(this.ddlStatusOper, 0);
            base.BindData2DDLBySysCode(this.MSCMovementType, "MoveType");
            this.ddlMovementTypeOper.SelectedValue = "One Of";
            base.BindData2DDLBySysCode(this.MSCReasonCode, "MoveReason");
            this.ddlReasonCodeOper.SelectedValue = "One Of";
            base.BindData2DDLBySysCode(this.MSCStatus, "MovementStatus");
            this.ddlStatusOper.SelectedValue = "One Of";
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadData();
            }
        }

        public string MovementDate
        {
            get
            {
                return "";
            }
        }

        public string MovementID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtMovementID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtMovementID.Text.Trim(), this.ddlMovementID.SelectedValue);
                }
                return "";
            }
        }

        public string MovementType
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCMovementType.ReturnValue))
                {
                    return base.GetParamsString(this.MSCMovementType.ReturnValue, this.ddlMovementTypeOper.SelectedValue);
                }
                return "";
            }
        }

        public string ReasonCode
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCReasonCode.ReturnValue))
                {
                    return base.GetParamsString(this.MSCReasonCode.ReturnValue, this.ddlReasonCodeOper.SelectedValue);
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCStatus.ReturnValue))
                {
                    return base.GetParamsString(this.MSCStatus.ReturnValue, this.ddlStatusOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

